<?php
/*
	Copyright 2006, 2007, 2008, 2009, 2010 Bastiaan Grutters
    
    This file is part of Ages of Strife website.

    Ages of Strife website is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Ages of Strife website is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Ages of Strife website.  If not, see <http://www.gnu.org/licenses/>.
 */
include( '../global/initialize.php' );

aos_header( 'Shoutbox' );
?>
					<div class="blok">
<?php
printDiplomacyTab( 'Shoutbox' );
?>
					</div>
					<br/>
					<div class="blok">
						<strong><?php transprint( 'Messages' ); ?></strong><br />
						<br />
						<div id="message-container">
							<?php transprint( 'Loading...' ); ?>
						</div>
						<br />
						<?php transprint( 'Show' ); ?> <select id="display-setting" onchange="YAHOO.shoutbox.updateChat( true );" value="10">
							<option value="10">10</option>
							<option value="20">20</option>
							<option value="50">50</option>
						</select> <?php transprint( 'messages' ); ?><br />
						<?php transprint( 'Page' ); ?>: <span id="page-setting">1</span> (<a href="javascript:void( null );" onclick="YAHOO.shoutbox.previousMessages();"><?php transprint( 'Previous' ); ?></a>, <a href="javascript:void( null );" onclick="YAHOO.shoutbox.nextMessages();"><?php transprint( 'Next' ); ?></a>)<br />
						<br />
						<div id="write-container">
							<strong><?php transprint( 'Write a message' ); ?></strong><br />
							<textarea id="write-area" cols="60" rows="4"></textarea>
							<br />
							<input type="button" onclick="YAHOO.shoutbox.addMessage();" value="<?php transprint( 'send' ); ?>" />
						</div>
<?php
$query = "SELECT access " .
		"FROM faction_member " .
		"WHERE ruler_id = " . $_SESSION[ 'ruler_id' ] . " AND invited = 0 AND requested = 0";
$result = mysql_query( $query ) or die( "Query failed : " . mysql_error() );
$row = mysql_fetch_array( $result, MYSQL_ASSOC );
if( isset( $row[ 'access' ] ) && $row[ 'access' ] >= 10 ) {
?>
						<br />
						<?php transprint( 'Click' ); ?> <a href="manage_faction_channels.php"><?php transprint( 'here' ); ?></a> <?php transprint( 'to manage faction chat channels.' ); ?><br />
<?php	
}
?>
					</div> <!-- close blok -->
					<br />
					<div class="blok">
						<strong><?php transprint( 'Shoutbox information' ); ?></strong><br />
						<?php transprint( 'Leave messages here for other rulers to see.' ); ?><br />
						<?php transprint( 'If you are part of a faction you will be able to see your factions messages or public messages,' ); ?><br />
						<?php transprint( 'if you are not in a faction you can only see public messages.' ); ?><br />
						<?php transprint( 'New messages are automatically retrieved, there is <em>no</em> need to <em>refresh</em> this page.' ); ?><br />
						<?php transprint( 'Messages are automatically removed after 2 weeks.' ); ?><br />
						<br />
						<?php transprint( 'The same rules apply as to the rest of the game.' ); ?><br />
						<?php transprint( 'Inappropriate messages will be removed.' ); ?><br />
						<br />
					</div>
					
<?php
aos_footer( "<script type=\"text/javascript\" src=\"shoutbox.js\"></script>" );
?>